home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / x / volume7 / xtiff / patch2 < prev    next >
Encoding:
Internet Message Format  |  1990-06-01  |  5.3 KB

  1. Path: uunet!clyde.concordia.ca!mcgill-vision!snorkelwacker!bu.edu!orc!decwrl!shelby!agate!bionet!ames!sun-barr!newstop!sun!decpa.pa.dec.com
  2. From: dbs@decpa.pa.dec.com (dan sears)
  3. Newsgroups: comp.sources.x
  4. Subject: v07i080: xtiff, Patch2, Part01/01
  5. Message-ID: <136494@sun.Eng.Sun.COM>
  6. Date: 1 Jun 90 03:36:31 GMT
  7. Sender: news@sun.Eng.Sun.COM
  8. Lines: 140
  9. Approved: argv@sun.com
  10.  
  11. Submitted-by: dbs@decpa.pa.dec.com (dan sears)
  12. Posting-number: Volume 7, Issue 80
  13. Archive-name: xtiff/patch2
  14. Patch-To: xtiff: Volume 7, Issue 36, 54
  15.  
  16. This patch fixes a bug in xtiff dealing with MINISWHTE images.
  17.  
  18. --Dan Sears
  19.  
  20. NB: xtiff.c requires libtiff version 2.2, which is currently in beta test.
  21.  
  22. -- cut here (patch.01) --
  23. diff -r -c rev1/patchlevel.h rev2/patchlevel.h
  24. *** rev1/patchlevel.h    Tue May 29 19:06:26 1990
  25. --- rev2/patchlevel.h    Tue May 29 19:02:02 1990
  26. ***************
  27. *** 1 ****
  28. ! #define PATCHLEVEL 1
  29. --- 1 ----
  30. ! #define PATCHLEVEL 2
  31. diff -r -c rev1/xtiff.c rev2/xtiff.c
  32. *** rev1/xtiff.c    Tue May 29 19:06:27 1990
  33. --- rev2/xtiff.c    Tue May 29 19:02:03 1990
  34. ***************
  35. *** 4,9 ****
  36. --- 4,11 ----
  37.    * Dan Sears
  38.    * Chris Sears
  39.    *
  40. +  * Revsion 1.2  90/05/29
  41. +  *      Fixed a bug with MINISWHTE images.
  42.    * Revsion 1.1  90/05/16
  43.    *      Fixed a few minor bugs.
  44.    * Revsion 1.0  90/05/07
  45. ***************
  46. *** 486,493 ****
  47.   
  48.       xGcValues.function = GXcopy;
  49.       xGcValues.plane_mask = AllPlanes;
  50. !     xGcValues.foreground = XWhitePixel(xDisplay, xScreen);
  51. !     xGcValues.background = XBlackPixel(xDisplay, xScreen);
  52.   
  53.       xWinGc = XCreateGC(xDisplay, xWindow, GCFunction | GCPlaneMask
  54.           | GCForeground | GCBackground, &xGcValues);
  55. --- 488,500 ----
  56.   
  57.       xGcValues.function = GXcopy;
  58.       xGcValues.plane_mask = AllPlanes;
  59. !     if (tfPhotometricInterpretation == PHOTOMETRIC_MINISWHITE) {
  60. !         xGcValues.foreground = XWhitePixel(xDisplay, xScreen);
  61. !         xGcValues.background = XBlackPixel(xDisplay, xScreen);
  62. !     } else {
  63. !         xGcValues.foreground = XBlackPixel(xDisplay, xScreen);
  64. !         xGcValues.background = XWhitePixel(xDisplay, xScreen);
  65. !     }
  66.   
  67.       xWinGc = XCreateGC(xDisplay, xWindow, GCFunction | GCPlaneMask
  68.           | GCForeground | GCBackground, &xGcValues);
  69. ***************
  70. *** 502,508 ****
  71.       size_hints.height = size_hints.min_height =
  72.           size_hints.max_height = tfImageHeight;
  73.   
  74. !     XSetStandardProperties(xDisplay, xWindow, programName, programName,
  75.           xTiffIconPixmap, xargv, xargc, &size_hints);
  76.   
  77.       if (colors != NULL)
  78. --- 509,515 ----
  79.       size_hints.height = size_hints.min_height =
  80.           size_hints.max_height = tfImageHeight;
  81.   
  82. !     XSetStandardProperties(xDisplay, xWindow, fileName, fileName,
  83.           xTiffIconPixmap, xargv, xargc, &size_hints);
  84.   
  85.       if (colors != NULL)
  86. ***************
  87. *** 587,614 ****
  88.               }
  89.           }
  90.       } else {
  91. !         /*
  92. !          * If the image is 1-bit and PHOTOMETRIC_MINISWHITE then invert
  93. !          * the image because we use the default colormap and can't change it.
  94. !          */
  95. !         if ((tfPhotometricInterpretation == PHOTOMETRIC_MINISWHITE)
  96. !             && (tfImageDepth == 1)) {
  97.               output_p = imageMemory = (u_char *)
  98.                   malloc(tfBytesPerRow * tfImageHeight);
  99.               MCHECK(imageMemory);
  100.   
  101. -             for (i = 0; i < tfImageHeight; i++, output_p += tfBytesPerRow) {
  102. -                 if (TIFFReadScanline(tfFile, output_p, i, 0) < 0)
  103. -                     break;
  104. -                 input_p = output_p;
  105. -                 for (j = 0; j < tfBytesPerRow; j++, input_p++)
  106. -                     *input_p = ~ *input_p;
  107. -             }
  108. -         } else if (xImageDepth == tfImageDepth) {
  109. -             output_p = imageMemory = (u_char *)
  110. -                 malloc(tfBytesPerRow * tfImageHeight);
  111. -             MCHECK(imageMemory);
  112.               for (i = 0; i < tfImageHeight; i++, output_p += tfBytesPerRow)
  113.                   if (TIFFReadScanline(tfFile, output_p, i, 0) < 0)
  114.                       break;
  115. --- 594,604 ----
  116.               }
  117.           }
  118.       } else {
  119. !         if (xImageDepth == tfImageDepth) {
  120.               output_p = imageMemory = (u_char *)
  121.                   malloc(tfBytesPerRow * tfImageHeight);
  122.               MCHECK(imageMemory);
  123.   
  124.               for (i = 0; i < tfImageHeight; i++, output_p += tfBytesPerRow)
  125.                   if (TIFFReadScanline(tfFile, output_p, i, 0) < 0)
  126.                       break;
  127. ***************
  128. *** 705,712 ****
  129.            * of depth one and use XCopyPlane().  This is idiomatic.
  130.            */
  131.           if (xImageDepth == 1) {
  132. !             xBitmapGc = XCreateGC(xDisplay, xImagePixmap, GCFunction
  133. !                 | GCPlaneMask | GCForeground | GCBackground, &xGcValues);
  134.               XPutImage(xDisplay, xImagePixmap, xBitmapGc, xImage,
  135.                   0, 0, 0, 0, xImage->width, xImage->height);
  136.           } else
  137. --- 695,701 ----
  138.            * of depth one and use XCopyPlane().  This is idiomatic.
  139.            */
  140.           if (xImageDepth == 1) {
  141. !             xBitmapGc = XCreateGC(xDisplay, xImagePixmap, 0, &xGcValues);
  142.               XPutImage(xDisplay, xImagePixmap, xBitmapGc, xImage,
  143.                   0, 0, 0, 0, xImage->width, xImage->height);
  144.           } else
  145.  
  146. dan
  147. ----------------------------------------------------
  148. O'Reilly && Associates   argv@sun.com / argv@ora.com
  149. Opinions expressed reflect those of the author only.
  150.